Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed cs migration template #1943

Merged

Conversation

michbeck
Copy link
Contributor

No description provided.

dereuromark
dereuromark previously approved these changes Jan 18, 2023
@dereuromark dereuromark requested a review from mringler January 18, 2023 12:05
Copy link
Contributor

@mringler mringler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, nice, just one problem with the return types of preUp() and preDown()

*
* @return void
*/
public function preUp(MigrationManager $manager): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preUp() does not have to return anything, but if it returns false, migration will be aborted. So the PHP return type is probably mixed? Maybe psalm allows for something like false|void.

Copy link
Contributor

@dereuromark dereuromark Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it is null|false|void in docblock it seems
Kind of shows why it is important to document those types :)

But kind of a code smell IMO legacy wise
Could we maybe use a different way to abort moving forward? Like using a specific exception that we catch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michbeck Can we omit the actual type for now and just document as I suggested?
We can then in a follow up PR fix it up to use an exception based halting instead of false smell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does psalm or stan complain if a method declares to throw an exception, but doesn't?
It would be a problem if this gives a warning:

    /**
     * @param \Propel\Generator\Manager\MigrationManager $manager
     *
     * @throws \...\AbortMigrationException
     * 
     * @return void
     */
    public function preUp(MigrationManager $manager)
    {
        // add the pre-migration code here
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thats fine IMO

@codecov-commenter
Copy link

Codecov Report

Base: 88.69% // Head: 88.69% // No change to project coverage 👍

Coverage data is based on head (ae3350e) compared to base (9bc3658).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1943   +/-   ##
=========================================
  Coverage     88.69%   88.69%           
  Complexity     8002     8002           
=========================================
  Files           243      243           
  Lines         24474    24474           
=========================================
  Hits          21706    21706           
  Misses         2768     2768           
Flag Coverage Δ
5-max 88.69% <ø> (ø)
7.4 88.69% <ø> (ø)
agnostic 67.43% <ø> (ø)
mysql 69.29% <ø> (ø)
pgsql 69.31% <ø> (ø)
sqlite 67.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dereuromark dereuromark requested a review from mringler January 19, 2023 08:44
@dereuromark dereuromark merged commit 8aa4f2b into propelorm:master Jan 19, 2023
@dereuromark
Copy link
Contributor

Follow up: Fix it using exception and void return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants